package com.example.everying.controller.feedback;/*
 * 项目名称: everything
 * 文件名: PlatformFeedbackController
 * 作者: 张泽阳
 * 日期: 2025/5/28
 * 描述:
 */

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.everying.model.vo.feedback.PlatformFeedbackVo;
import com.example.everying.model.dto.feedback.PlatformFeedbackPageDto;
import com.example.everying.model.entity.feedback.PlatformFeedBack;
import com.example.everying.service.feedback.PlatformFeedbackService;
import com.example.everying.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/feedback")
public class PlatformFeedbackController {

    @Autowired
    private PlatformFeedbackService platformFeedbackService;

    @PostMapping("/addFeedback")
    public Result<?> addFeedback( @RequestBody @Validated PlatformFeedBack platformFeedBack){
        return platformFeedbackService.addFeedback(platformFeedBack);
    }

    @PostMapping("/list")
    public Result<?> list(@RequestBody @Validated PlatformFeedbackPageDto platformFeedbackPageDto){
        return platformFeedbackService.list(platformFeedbackPageDto);
    }

    @PostMapping("/page")
    public Result<?> page(@RequestBody @Validated PlatformFeedbackPageDto platformFeedbackPageDto){
        Page<PlatformFeedbackVo> pageParam = new Page<>(platformFeedbackPageDto.getPage(), platformFeedbackPageDto.getLimit());
        return platformFeedbackService.selectPageWithUser(pageParam, platformFeedbackPageDto);
    }
}
